#pragma once
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <malloc.h>

#define MAX 100
#define MAX_NAME 10
#define MAX_SEX 5
#define MAX_TELE 12
#define MAX_ADDR 30

#define DEFAULT_SZ 3
#define ADD_SZ 3

enum OPTION
{
	EXIT,
	ADD,
	DEL,
	SEARCH,
	MODIFY,
	SHOW,
	SORT
};

typedef struct PeoInfo
{
	char name[MAX_NAME];
	int age;
	char sex[MAX_SEX];
	char tele[MAX_TELE];
	char addr[MAX_ADDR];
}PeoInfo;

//typedef struct Contact
//{
//	PeoInfo data[MAX];
//	int sz;
//}Contact;

typedef struct Contact
{
	PeoInfo* data;
	int sz;
	int capacity;
}Contact;

void InitContact(Contact* con);

void AddContact(Contact* con);

void ShowContact(const Contact* con);

void DelContact(Contact* con);

int FindByName(const Contact* con, char* name);

void SearchContact(Contact* con);

void ModifyContact(Contact* con);

void DestoryContact(Contact* con);

void SaveContact(Contact* con);

int CheckCapacity(Contact* con);

